package jannex.sql;

import jannex.JannexException;
import jannex.mapping.ResultSetHandler;

import java.io.InputStream;
import java.io.Reader;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Date;
import java.sql.RowId;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;

public interface JxPreparedStatement extends java.sql.PreparedStatement, JxStatement {

    default void setObjects(Object... arguments) throws JannexException {
        if (arguments != null) {
            for (int i = 0; i < arguments.length; i++) {
                setObject(i + 1, arguments[i]);
            }
        }
    }
    <E> TypedPreparedStatement<E> as(Class<E> elementClass) throws JannexException;

    <E> TypedPreparedStatement<E> as(ResultSetHandler<E> handler) throws JannexException;


    @Override
    void close() throws JannexException;

    @Override
    void setNClob(int parameterIndex, Reader reader) throws JannexException;

    @Override
    void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws JannexException;

    @Override
    void setAsciiStream(int parameterIndex, InputStream x, long length) throws JannexException;

    @Override
    void setBinaryStream(int parameterIndex, InputStream x, long length) throws JannexException;

    @Override
    void setCharacterStream(int parameterIndex, Reader reader, long length) throws JannexException;

    @Override
    void setAsciiStream(int parameterIndex, InputStream x) throws JannexException;

    @Override
    void setBinaryStream(int parameterIndex, InputStream x) throws JannexException;

    @Override
    void setCharacterStream(int parameterIndex, Reader reader) throws JannexException;

    @Override
    void setNCharacterStream(int parameterIndex, Reader value) throws JannexException;

    @Override
    void setClob(int parameterIndex, Reader reader) throws JannexException;

    @Override
    void setBlob(int parameterIndex, InputStream inputStream) throws JannexException;

    @Override
    void addBatch() throws JannexException;

    @Override
    void setCharacterStream(int parameterIndex, Reader reader, int length) throws JannexException;

    @Override
    void setRef(int parameterIndex, java.sql.Ref x) throws JannexException;

    @Override
    void setBlob(int parameterIndex, java.sql.Blob x) throws JannexException;

    @Override
    void setClob(int parameterIndex, java.sql.Clob x) throws JannexException;

    @Override
    void setArray(int parameterIndex, java.sql.Array x) throws JannexException;

    @Override
    JxResultSetMetaData getMetaData() throws JannexException;

    @Override
    void setDate(int parameterIndex, Date x, Calendar cal) throws JannexException;

    @Override
    void setTime(int parameterIndex, Time x, Calendar cal) throws JannexException;

    @Override
    void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws JannexException;

    @Override
    void setNull(int parameterIndex, int sqlType, String typeName) throws JannexException;

    @Override
    void setURL(int parameterIndex, URL x) throws JannexException;

    @Override
    JxParameterMetaData getParameterMetaData() throws JannexException;

    @Override
    void setRowId(int parameterIndex, RowId x) throws JannexException;

    @Override
    void setNString(int parameterIndex, String value) throws JannexException;

    @Override
    void setNCharacterStream(int parameterIndex, Reader value, long length) throws JannexException;

    @Override
    void setNClob(int parameterIndex, java.sql.NClob value) throws JannexException;

    @Override
    void setClob(int parameterIndex, Reader reader, long length) throws JannexException;

    @Override
    void setBlob(int parameterIndex, InputStream inputStream, long length) throws JannexException;

    @Override
    void setNClob(int parameterIndex, Reader reader, long length) throws JannexException;

    @Override
    void setSQLXML(int parameterIndex, java.sql.SQLXML xmlObject) throws JannexException;

    @Override
    void setNull(int parameterIndex, int sqlType) throws JannexException;

    @Override
    void setBoolean(int parameterIndex, boolean x) throws JannexException;

    @Override
    void setByte(int parameterIndex, byte x) throws JannexException;

    @Override
    void setShort(int parameterIndex, short x) throws JannexException;

    @Override
    void setInt(int parameterIndex, int x) throws JannexException;

    @Override
    void setLong(int parameterIndex, long x) throws JannexException;

    @Override
    void setFloat(int parameterIndex, float x) throws JannexException;

    @Override
    void setDouble(int parameterIndex, double x) throws JannexException;

    @Override
    void setBigDecimal(int parameterIndex, BigDecimal x) throws JannexException;

    @Override
    void setString(int parameterIndex, String x) throws JannexException;

    @Override
    void setBytes(int parameterIndex, byte[] x) throws JannexException;

    @Override
    void setDate(int parameterIndex, Date x) throws JannexException;

    @Override
    void setTime(int parameterIndex, Time x) throws JannexException;

    @Override
    void setTimestamp(int parameterIndex, Timestamp x) throws JannexException;

    @Override
    void setAsciiStream(int parameterIndex, InputStream x, int length) throws JannexException;

    @Override
    @Deprecated
    void setUnicodeStream(int parameterIndex, InputStream x, int length) throws JannexException;

    @Override
    void setBinaryStream(int parameterIndex, InputStream x, int length) throws JannexException;

    @Override
    void clearParameters() throws JannexException;

    @Override
    void setObject(int parameterIndex, Object x, int targetSqlType) throws JannexException;

    @Override
    void setObject(int parameterIndex, Object x) throws JannexException;

    @Override
    boolean execute() throws JannexException;

    @Override
    JxResultSet executeQuery() throws JannexException;

    @Override
    int executeUpdate() throws JannexException;

}